﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DcsGauges.Gui.Gauges.Trigger;

namespace DcsGauges.Gui.Gauges.ValueConverters
{
    class TwoStateToggleSwitchConverter : StateConverter<TwoStateToggleSwitchGauge.SwitchStates>
    {
        public TwoStateToggleSwitchConverter() 
            : base
            (
                convertFunction: (v) =>
                    {
                        if(v > 0.0f)                return TwoStateToggleSwitchGauge.SwitchStates.State1;
                        else                        return TwoStateToggleSwitchGauge.SwitchStates.State0;
                    },
                convertBackFunction: (s) =>
                    {
                        if(s == TwoStateToggleSwitchGauge.SwitchStates.State1)      return 1.0f;
                        else                                                        return 0.0f;
                    }
            )
        {

        }
    }
}
